{template header}

<div class="container">

<div class="row">

<div class="col-md-8">

    {template menu}


    <div class="bbox bbox-nbt" id="info">
        <ul class="nav nav-pills" style="padding: 10px">
            {if isMobile()}
            <li>
                <select onchange="jumpto(this.options[this.options.selectedIndex].value)" name="typeid" id="typeid" class="form-control">
                    <option value="{tsUrl('user','duty',array('id'=>$strUser['userid']))}">服务</option>
                    <option value="{tsUrl('user','event',array('id'=>$strUser['userid']))}" >活动</option>
                    <option value="{tsUrl('user','article',array('id'=>$strUser['userid']))}" >文档</option>
                    <option value="{tsUrl('user','wish',array('id'=>$strUser['userid']))}" >心愿</option>
                    <option value="{tsUrl('user','gift',array('id'=>$strUser['userid']))}" >义卖</option>
                    <option value="{tsUrl('user','weibo',array('id'=>$strUser['userid']))}">动态</option>
                    {if $GLOBALS['TS_USER']['isadmin']=='1'}
                    <option value="{tsUrl('user','comment',array('id'=>$strUser['userid']))}"   selected>备注</option>
                    {/if}

                </select>
            </li>
            {else}
            <li role="presentation"><a href="{tsUrl('user','duty',array('id'=>$strUser['userid']))}">服务</a></li>
             <li role="presentation"><a href="{tsUrl('user','event',array('id'=>$strUser['userid']))}">活动</a></li>
            <li role="presentation"><a href="{tsUrl('user','article',array('id'=>$strUser['userid']))}">文档</a></li>
            <li role="presentation"><a href="{tsUrl('user','gift',array('id'=>$strUser['userid']))}">义卖</a></li>
            <li role="presentation"><a href="{tsUrl('user','weibo',array('id'=>$strUser['userid']))}">动态</a></li>
            {if $GLOBALS['TS_USER']['isadmin']=='1'}
            <li role="presentation" class="active"><a href="{tsUrl('user','comment',array('id'=>$strUser['userid']))}">备注</a></li>
            {/if}
            {/if}
        </ul>
        <div class="bc">
            <div class="topic_list" style="padding-top:10px" >
                <form method="POST"   action="{SITE_URL}index.php?app=user&ac=do&ts=postcomment"  onSubmit="return submitonce(this)" id="formMini">

                    <div class="wangeditor_toolbar" id="tseditor"></div>
                    <div class="wangeditor_text" id="tseditor2"></div>
                    <div style="display: none"><textarea name="content"></textarea></div>
                    <br />
                    <span style="float: left">限社区管理员浏览</span>
                    <p class="fr">
                        <input type="hidden" name="groupid" value="{$groupid}"/>
                        <input type="hidden" name="type" value="{$type}"/>
                        <input type="hidden" name="userid"  value="{$userid}"" />
                        <input type="hidden" name="token" value="{$_SESSION['token']}" />

                        <button class="btn btn-success" type="submit">提交备注</button>
                    </p>
                </form>
            </div>

            <div class="clear"></div>

            <div class="comment" style="padding-top:30px" >
                <ul>
                    {if $arrComment}
                    {loop $arrComment $key $item}
                    <li class="clearfix">
                        <div class="user-face">
                            <a href="{tsUrl('user','duty',array('id'=>$item[author][userid]))}"><img class="img-rounded" title="{$item[author][username]}" alt="{$item[author][username]}" src="{$item[author][face]}" width="32" /></a>
                        </div>
                        <div >
                            <div class="author"><a href="{tsUrl('user','duty',array('id'=>$item[user][userid]))}">{$item[author][username]}</a>&nbsp;&nbsp;{php echo getTime($item[addtime],time())}{if $item['authorid']==$GLOBALS['TS_USER']['userid']}<span style="float: right"><a class="btn-default" onclick="del({$item[commentid]})">删除</a></span>{/if}</div>
                             <div class="reply-doc">
                                {if $item[photo]}<a target="_blank" href="{SITE_URL}uploadfile/weibo/{$item[photo]}"><img src="{php echo tsXimg($item['photo'],'weibo',240,'',$item['path'])}" /></a>{/if}
                                {$item[content]}
                            </div>
                        </div>

                    </li>
                    <div class="clear"></div>
                    {/loop}
                    {else}
                    <li>没有人给ta做过备注</li>
                    {/if}
                </ul>
            </div>

            <div class="clear"></div>
            <div class="page">{$pageUrl}</div>
            <div>

            </div>

        </div>
</div>
</div>
</div>
<script>

    //提交
    $(function(){
        $('#comm-form').on('submit', function(e) {
            var content  = $('#content').val();
            var userid = {php echo $userid };

            var text = Trim(content,'g');
            if(text == ''){
                bootbox.alert('内容不能为空');
                return false;
            }
            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=user&ac=do&ts=postcomment",
                data: "userid="+userid+"&content="+content,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        });

    });



    //删除
    function del(commentid){
        $.ajax({
            type: "POST",
            url: siteUrl+"index.php?app=user&ac=do&ts=delcomment",
            data: "commentid="+commentid,
            beforeSend:function(){
            },
            success:function(result){
                if(result == '1'){
                    window.location.reload();
                }
            }
        });
    }

    //修改
    function edit(commentid){
        content=$('#content'.commentid).val();
        if(content==''){
            bootbox.alert('内容不能为空！');
            return false;
        }
        $.ajax({
            type: "POST",
            url: siteUrl+"index.php?app=user&ac=do&ts=editcomment",
            data: "commentid="+commentid+'&content='+content,
            beforeSend:function(){
            },
            success:function(result){
                if(result == '1'){
                    window.location.reload();
                }
            }
        });
    }

</script>

</div>
</div>

{php doAction('tseditor','mini')}
{template footer}